# set path
set(THIRD_PARTY_PATH $ENV{HOME}/.xict/third_libs)
set(YALK_RUNTIME_PATH ${THIRD_PARTY_PATH}/yalk)

# get platform
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
    set(YALK_PLATFORM "x86_64")
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64" OR ${CMAKE_SYSTEM_PROCESSOR}
    MATCHES "armv8")
    set(YALK_PLATFORM "aarch64")
else()
    message(FATAL_ERROR "[yalk.cmake] unsupported platform")
endif()

# set lib and include path
if(EXISTS ${YALK_RUNTIME_PATH})
    # we should have libyalk.so in lib folder
    set(YALK_LIB ${YALK_RUNTIME_PATH}/lib/${YALK_PLATFORM}/libyalk.so)

    # we should have yalk.h in include folder
    set(YALK_INCLUDE_DIR ${YALK_RUNTIME_PATH}/include)
else()
    message(
        FATAL_ERROR
        "[yalk.cmake] YALK_RUNTIME_PATH (${YALK_RUNTIME_PATH}) not found")
endif()
